﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ANZ_AIM_GUI.Utils;
using ANZ_AIM_BLL;
using ANZ_AIM_BLL.Model;

namespace ANZ_AIM_GUI
{
    public partial class frmSaleInfoVerifyStatus : Form
    {
        public string batchFileSaleInfoID { get; set; }
        public string typeSaleInfo { get; set; }
        public frmSaleInfoVerifyStatus()
        {
            InitializeComponent();
        }

        public frmSaleInfoVerifyStatus(string batchFileSaleInfoID)
            : this()
        {
            this.batchFileSaleInfoID = batchFileSaleInfoID;
        }

        public frmSaleInfoVerifyStatus(string batchFileSaleInfoID,string type)
            : this()
        {
            this.batchFileSaleInfoID = batchFileSaleInfoID;
            this.typeSaleInfo = type;
        }

        private void btnVeriry_Click(object sender, EventArgs e)
        {
            try
            {
                BatchFileSaleInfoUploadBLL batchFileSaleInfoUploadBll = new BatchFileSaleInfoUploadBLL();
                batchFileSaleInfoUploadBll.UpdateStatus(batchFileSaleInfoID, Constant.NEED_TO_APPROVE);

                if (this.typeSaleInfo == Constant.TYPE_PIP)
                {
                    SalePIPBLL salePIPBll = new SalePIPBLL();
                    salePIPBll.UpdateByBatchFile(batchFileSaleInfoID, Constant.NEED_TO_APPROVE);
                }

                MessageBox.Show("Vefiry successfully.", Constant.SYS_INFORMATION, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            { }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
